package com.ruoyi.web.tdmdata.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.web.tdmdata.domain.TdmZhiLiaoYaoWu;
import com.ruoyi.web.tdmdata.service.ITdmZhiLiaoYaoWuService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * id-11  -23  治疗药物检测Controller
 * 
 * @author ly
 * @date 2022-03-14
 */
@RestController
@RequestMapping("/tdmdata/TdmZhiLiaoYaoWu")
public class TdmZhiLiaoYaoWuController extends BaseController
{
    @Autowired
    private ITdmZhiLiaoYaoWuService tdmZhiLiaoYaoWuService;

    /**
     * 查询id-11  -23  治疗药物检测列表
     */
    // @PreAuthorize("@ss.hasPermi('tdmdata:TdmZhiLiaoYaoWu:list')")
    @GetMapping("/list")
    public TableDataInfo list(TdmZhiLiaoYaoWu tdmZhiLiaoYaoWu)
    {
        startPage();
        List<TdmZhiLiaoYaoWu> list = tdmZhiLiaoYaoWuService.selectTdmZhiLiaoYaoWuList(tdmZhiLiaoYaoWu);
        return getDataTable(list);
    }

    /**
     * 导出id-11  -23  治疗药物检测列表
     */
    // @PreAuthorize("@ss.hasPermi('tdmdata:TdmZhiLiaoYaoWu:export')")
    @Log(title = "id-11  -23  治疗药物检测", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TdmZhiLiaoYaoWu tdmZhiLiaoYaoWu)
    {
        List<TdmZhiLiaoYaoWu> list = tdmZhiLiaoYaoWuService.selectTdmZhiLiaoYaoWuList(tdmZhiLiaoYaoWu);
        ExcelUtil<TdmZhiLiaoYaoWu> util = new ExcelUtil<TdmZhiLiaoYaoWu>(TdmZhiLiaoYaoWu.class);
        util.exportExcel(response, list, "id-11  -23  治疗药物检测数据");
    }

    /**
     * 获取id-11  -23  治疗药物检测详细信息
     */
    //@PreAuthorize("@ss.hasPermi('tdmdata:TdmZhiLiaoYaoWu:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(tdmZhiLiaoYaoWuService.selectTdmZhiLiaoYaoWuById(id));
    }

    /**
     * 新增id-11  -23  治疗药物检测
     */
    // @PreAuthorize("@ss.hasPermi('tdmdata:TdmZhiLiaoYaoWu:add')")
    @Log(title = "id-11  -23  治疗药物检测", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TdmZhiLiaoYaoWu tdmZhiLiaoYaoWu)
    {
        return toAjax(tdmZhiLiaoYaoWuService.insertTdmZhiLiaoYaoWu(tdmZhiLiaoYaoWu));
    }

    /**
     * 修改id-11  -23  治疗药物检测
     */
    //@PreAuthorize("@ss.hasPermi('tdmdata:TdmZhiLiaoYaoWu:edit')")
    @Log(title = "id-11  -23  治疗药物检测", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TdmZhiLiaoYaoWu tdmZhiLiaoYaoWu)
    {
        return toAjax(tdmZhiLiaoYaoWuService.updateTdmZhiLiaoYaoWu(tdmZhiLiaoYaoWu));
    }

    /**
     * 删除id-11  -23  治疗药物检测
     */
    //@PreAuthorize("@ss.hasPermi('tdmdata:TdmZhiLiaoYaoWu:remove')")
    @Log(title = "id-11  -23  治疗药物检测", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tdmZhiLiaoYaoWuService.deleteTdmZhiLiaoYaoWuByIds(ids));
    }
}
